#include <bits/stdc++.h>
using namespace std;
int n,a[100005],r[100005],b[100005],maxr=-99999,c[100005],ans,t=1;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&r[i]);
        if(maxr<r[i]) maxr=r[i];
        b[r[i]]++;
    }
    for(int i=1;i<=maxr;i++){//
        if(b[i]!=0) {
            c[t]=b[i];
            t++;
        }
    }//
    if(maxr==2) {
        if(b[1]>b[2]){
            cout<<n-b[2];
        }else{
            cout<<b[2];
        }
    }else if(n<=10){//
        for(int i=1;i<t;i++){
            if(c[i]>c[i+1]){
                ans=ans+c[i+1];
            }else{
                ans=ans+c[i];
            }
        }
        cout<<n-ans;//
    }else{
        cout<<1;
    }

    return 0;
}
